import type { postOrPutType } from "@/constants";
import type { HasId, IList, IResult } from "@/types/common";
import { getAxios, commonAxiosJson, exportExcelAxios } from "@/utils/request.js";
/* 店铺 地址 */
const url = "/back/store";
/* 获取店铺列表信息 */
export const getStoreInfo = <T, D>(params: D): Promise<IResult<IList<T>>> => {
  return getAxios<IList<T>, D>(url, params);
};
/*店铺：通过id获取店铺详情信息 */
export const getStoreByIdInfo = <T, D extends HasId>(params: D): Promise<IResult<T>> => {
  return getAxios<T, D>(url + "/" + params.id, params);
};
/* 店铺 新增，修改店铺信息 */
export const commonStoreInfo = <T, D>(params: D, type: postOrPutType): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url, params, type);
};
/* 修改 店铺 保证金 信息 */
export const putStoreDepositInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-deposit", params, "PUT");
};
/* 修改 店铺 入驻信息 信息 */
export const putStoreSettledInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-settled", params, "PUT");
};
/* 修改 店铺 备注信息 信息 */
export const putStoreNoteInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-store-note", params, "PUT");
};
/* 导出店铺列表信息 */
export const getStoreExportInfo = <D>(params: D): Promise<Blob> => {
  return exportExcelAxios<D>(url + "/export", "GET", params);
};
/* 审核店铺合同信息 */
export const putStoreContractInfo = <T, D>(params: D): Promise<IResult<T>> => {
  return commonAxiosJson<T, D>(url + "/update-contract", params, "PUT");
};
